Socket
Socket
Sign inDemoInstall

banner-webpack-plugin

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

banner-webpack-plugin

append content before or after js bundle


Version published
Weekly downloads
1.2K
increased by12.93%
Maintainers
2
Weekly downloads
 
Created
Source

banner-webpack-plugin

Introduction

append content before or after js bundle

Usage

if entry key in webpack config is like this:

entry: {
    "libs/react": [path.join(config.path.src, "/libs/react.js")],
    "libs/react-dom": [path.join(config.path.src, "/libs/react-dom.js")],
},

then, please use the same key for chunks in banner-webpack-plugin

new BannerWebpackPlugin({
    chunks: {
        'libs/react': {
            beforeContent: 'var React = ',              
            afterContent: ');/**heyman*/',              
            removeBefore: "!",                           
            removeAfter: "\\);"
        },
        'libs/react-dom': {
            beforeContent: 'var ReactDOM = ',
            afterContent: ');/**heyman*/',
            removeBefore: "!",
            removeAfter: "\\);"
        }
    }
})

Defailt of chunks key

* beforeContent
    - [String] 
    - append content before
* afterContent
    - [String] 
    - append content after
* removeBefore
    - [String] 
    - replace content before, this string will input in a Regex Object
* removeAfter
    - [String]
    - replace content after, this string will input in a Regex Object

Result

var React = /******/ function(modules) { // webpackBootstrap
	/** some code here */
/******/ }); /** heyman */;

Keywords

FAQs

Package last updated on 25 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc